#include<stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

typedef struct 
{
	int index;
	int times;
}str;

void exchange(str *a,str *b)
{
	str temp;
	temp.index = a -> index;
	temp.times = a -> times; 
	a -> index  = b -> index ;
	a -> times = b -> times;  
	b -> index  = temp.index;
	b -> times = temp.times; 
}


int Partition(str a[],int p,int r)
{
	str x = a[r];
	int i = p-1;
	int j = p;
	for(;j<=r-1;j++)
	{
		if(a[j].times<x.times)
		{
			i+=1;
			exchange(&a[i],&a[j]);
		}
	}
	exchange(&a[i+1],&a[r]);
	return i+1;
}

void QuickSort(str a[],int p,int r)
{
	int q;
	if (p<r)
	{
		q = Partition(a,p,r);
		QuickSort(a,p,q-1);
		QuickSort(a,q+1,r);
	}
}


int main() 
{ 

#ifdef FILEIO
	freopen("in.txt","r",stdin); 
	freopen("out.txt","w",stdout); 
#endif
	int lotto[9] = {0};
	int mem[50] = {0};
	str l[50] = {0};

	int choice1[7] = {40,21,6,27,39,15,29};
	int choice2[7] = {25,13,5,8,23,33,41};

	int i = 0;

	int N = 25; //200
	while(N-- > 0)
	{
		for(i = 0;i<9;i++)
			scanf("%d",&lotto[i]);

		for(i = 0;i<9;i++)
		{
			mem[lotto[i]]++;
		}
		//        printf("%d ",lotto[i]);
		//      printf("\n");
	}

	for(i = 0;i<50;i++)
	{
		// printf("%d %d\n",i,mem[i]);
		l[i].index = i;
		l[i].times = mem[i];
	}

	QuickSort(l,0,49);

	for(i = 0;i<50;i++)
	{
		printf("%d,%d\n",l[i].index,l[i].times);
	}  


#ifdef FILEIO
	fclose(stdin);
	fclose(stdout);
#endif  

	return 0; 
}
